import request from './request.js'

export function addChatToServe() {
  return request({
    url: '/chat',
    method: 'post'
  })
}

export function queryChatFromServe() {
  return request({
    url: '/chat' ,
    method: 'get'
  })
}

export function getChatDetailsFromServe(chatHistoryId){
  return request({
    url: '/chatDetails',
    method: 'get',
    params:{chatHistoryId: chatHistoryId}
  })
}

export function clearChatToServe(ids){
  return request({
    url: '/chat',
    method: 'delete',
    data:ids

  })
}

export function deleteChatToServe(chatHistoryId) {
  return request({
    url: '/chat',
    method: 'delete',
    data:[].concat(chatHistoryId)
  })
}

export function modifyChatNameToServe(chatHistoryId,name){
  return request({
    url: '/chat',
    method: 'put',
    params: { id: chatHistoryId,name:name }
  })
}

export function searchChat(ids,context){
  return request({
    url: '/chatDetails',
    method: 'post',
    data:{chatHistoryIds:ids,context:context}
  })
}